package zhoumo;

public class StringDemo {
    public static void main(String[] args) {
        String s=new String("HELLO");
        String s1="HELLO";
        String s2="          HEllo           ";
        String s3="thinking in java";
        String s4="www.baidu.com";
        int a=123;
        System.out.println(s1==s2);
        System.out.println(s==s1);
        System.out.println(s.equals(s1));
        System.out.println(s2.length());
        System.out.println(s2.trim());
        System.out.println(s.toLowerCase());
        System.out.println(s.startsWith("HE"));
        System.out.println(s.endsWith("ll"));
        System.out.println(s.charAt(2));
        System.out.println(s3.indexOf("in",6));
        System.out.println(s3.lastIndexOf("in"));
        int start=s4.indexOf(".")+1;
        int end=s4.indexOf(".",start);
        System.out.println(s4.substring(start,end));
        String s5=String.valueOf(a);
        double b=123.123;
        String s6=String.valueOf(b);
        String s7=b+"";
        System.out.println("s7 = " + s7);
        String s8="好好学习java";
        StringBuilder builder=new StringBuilder(s8);
        builder.append("就是为了找个好工作");
        System.out.println(builder);
        builder.replace(s8.length(),builder.length(),"就是为了改变是世界");
        System.out.println("builder = " + builder);
        builder.delete(0,s8.length());
        System.out.println("builder = " + builder);
        builder.insert(0,"活着");
        System.out.println("builder = " + builder);


    }
}
